Finalize RDoc::Options before calling RDoc::RDoc#parse_files#1274
Merged
st0012 merged 1 commit intoruby:masterfrom Jan 8, 2025
Merged
Finalize RDoc::Options before calling RDoc::RDoc#parse_files#1274st0012 merged 1 commit intoruby:masterfrom
st0012 merged 1 commit intoruby:masterfrom
Conversation
Commit 6cf6e16, which went to v6.5.0, changed RDoc::Options#parse to not call #finish in it. While the commit adjusted other call sites, it missed lib/rdoc/rubygems_hook.rb. RDoc::Options#finish prepares the include paths for :include: directives. This has to be done before starting to parse sources.
matzbot
pushed a commit
to ruby/ruby
that referenced
this pull request
Jan 8, 2025
RDoc::RDoc#parse_files (ruby/rdoc#1274) Commit ruby/rdoc@6cf6e1647b97, which went to v6.5.0, changed `RDoc::Options#parse` to not call `#finish` in it. While the commit adjusted other call sites, it missed `lib/rdoc/rubygems_hook.rb`. `RDoc::Options#finish` prepares the include paths for `:include:` directives. This has to be done before starting to parse sources. I think this should fix ruby/net-http#193 + ruby/net-http#194. ruby/rdoc@d62da8ca09
tompng
added a commit
that referenced
this pull request
Apr 23, 2025
…1347) Probably fixes #1343 `options.finish` is called twice while generating document through rubygems_hook. If gemspec has `spec.rdoc_options << '--ri'`, document generation fails. Looks like this double-finish is introduced in #1274 ### Detail of the bug ```ruby options = ::RDoc::Options.new options.parse args # if --ri is specified, generator is set to 'ri' options.finish # @template='ri' and @template_dir=nil is configured here @rdoc.parse_files options.files document 'ri', options, @rdoc_dir document 'darkfish', options, @rdoc_dir # Calls options.setup_generator('darkfish') and options.finish but @template_dir is already configured for 'ri' ``` ### Fix Constraints are: - Need to call finish only once for each RDoc::Options instance - `finish` should be called before `rdoc.parse_files(options.files)` - `finish` should be called after `options.setup_generator` - It is better to call `rdoc.parse_files` only once We need to use a different RDoc::Options object for parse_files phase and document generation phase.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Commit 6cf6e16, which went to v6.5.0, changed
RDoc::Options#parseto not call#finishin it. While the commit adjusted other call sites, it missedlib/rdoc/rubygems_hook.rb.RDoc::Options#finishprepares the include paths for:include:directives. This has to be done before starting to parse sources.I think this should fix ruby/net-http#193 + ruby/net-http#194.